#include <Measurement.h>

template <typename Unit>
Measurement<Unit>::Measurement(unsigned int amount, const Unit* unit)
    : amountInBase(amount * unit->toBase())
    , unit(unit)
{
}

template <typename Unit>
Measurement<Unit>::Measurement(unsigned int amountInBase)
    : amountInBase(amountInBase)
{
}

template <typename Unit>
bool Measurement<Unit>::operator == (const Measurement<Unit>& second) const
{
    return this->amountInBase == second.amountInBase;
}

template <typename Unit>
bool Measurement<Unit>::operator != (const Measurement<Unit>& second) const
{
    return !(*this == second);
}

template <typename Unit>
Measurement<Unit> Measurement<Unit>::operator + (const Measurement<Unit>& second) const
{
	return Measurement(this->amountInBase + second.amountInBase);
}

//template<typename Unit>
//unsigned int Measurement<Unit>::operator / (const Measurement& second) const
//{
//     return (this->amountInBase / second.amountInBase);
//}
//
//template<typename Unit>
//Measurement<Unit> Measurement<Unit>::operator % (const Measurement& second) const
//{
//    return Measurement(this->amountInBase % second.amountInBase, unit);
//}

template<typename Unit>
std::string Measurement<Unit>::outputString(){
    return unit->outputString(amountInBase);
}
